<template>
	<view class="forum_detail">
		<view class="title">{{ detail.title }}</view>
		<view class="company_item flex-ali justify-between">
			<view class="company_size"></view>
			<view class="time">{{ detail.createtime }}</view>
		</view>
		<view class="content">
			<image v-if="detail.image" class="content_img" :src="ossUrl + detail.image" mode="widthFix"></image>
			<rich-text style="line-height: 58rpx;" :nodes="detail.content"></rich-text>
		</view>
	</view>
</template>

<script>
	import {
		remoteUrl,
		ossUrl
	} from '@/utils/config.js'
	import {
		noticeInfo
	} from '@/api/forum.js'
	export default {
		data() {
			return {
				ossUrl: ossUrl,
				remoteUrl: remoteUrl,
				notice_id: '',
				detail: '',
			};
		},
		onLoad(options) {
			this.notice_id = options.id
			this.getNoticeInfo()
		},
		onShareAppMessage(res) { //发送给朋友
			return {
				title: '小程序分享',
				imageUrl: '',
			}
		},
		methods: {
			getNoticeInfo() {
				noticeInfo({
					id: this.notice_id,
				}).then(res => {
					if (res.code == 1) {
						let str = res.data.content.replaceAll('style=','')
						const regex = new RegExp('img','gi')
						res.data.content = str.replace(regex,`img style="max-width: 100%;"`)
						this.detail = res.data
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.forum_detail {
	padding: 32rpx 28rpx;
	.title {
		text-align: center;
		font-size: 36rpx;
		color: #000000;
	}
	.company_item {
		font-size: 24rpx;
		margin: 28rpx 0 35rpx 0;
	}
	.content {
		.content_img {
			width: 100%;
		}
	}
}
</style>
